package cn.shengongying.service.impl;

import cn.shengongying.dao.BossPositionMapper;
import cn.shengongying.model.BossPosition;
import cn.shengongying.service.IBossPositionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 职位管理 服务实现类
 * </p>
 *
 * @author RXK
 * @since 2022-01-05
 */
@Service
public class BossPositionServiceImpl extends ServiceImpl<BossPositionMapper, BossPosition> implements IBossPositionService {

    private final BossPositionMapper positionMapper;

    public BossPositionServiceImpl(BossPositionMapper positionMapper) {
        this.positionMapper = positionMapper;
    }

    @Override
    public List<BossPosition> findByBossId(Long userId, Integer type) {
        return positionMapper.findByBossId(userId,type);
    }

    @Override
    public void updateTopStatus(Long id, Integer topStatus) {
        BossPosition position = new BossPosition();
        position.setId(id);
        position.setTopStatus(topStatus);
        positionMapper.updateById(position);
    }

    @Override
    public void updateStatusById(Long id, int status) {
        BossPosition position = new BossPosition();
        position.setId(id);
        position.setStatus(status);
        positionMapper.updateStatusById(position);
    }

}
